import React from 'react';
import { View, Text, Button } from 'react-native';
import { StackNavigator } from 'react-navigation';

const HomeScreen = ({ navigation }) => (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
        <Text>Home Screen</Text>
        <Button
            onPress={() => navigation.navigate('Details',{name:'后盾人'})}
            title="Go to details"
        />
    </View>
);

const DetailsScreen = (navigation) => {
    console.log(navigation.navigation.state.params.name);
    let houdun = navigation.navigation.state.params.name
    return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
        <Text style={{fontSize:30}}>Details Screen{houdun}</Text>
    </View>
)};





const RootNavigator = StackNavigator({
    Home: {
        screen: HomeScreen,
        navigationOptions: {
            headerTitle: '后盾人首页',
        },
    },
    Details: {
        screen: DetailsScreen,
        navigationOptions: {
            headerTitle: 'Details',
        },
    },

});

export default RootNavigator;